#include<iostream>
#include<string>
#include<vector>
using namespace std;
int judge(char a,char b){
  if(a==b) return 1;
  if(a=='S'&&b=='P') return 2;
  if(a=='P'&&b=='R') return 2;
  if(a=='R'&&b=='S') return 2;
  return 0;
}
void score(string &own,vector<string> bro){
  int cnt1=0,cnt2=0;
  string str="SPR";
  for(int i=0;i<own.size();i++){
    vector<int> scores(3,0);
    for(string &x:bro){
      cnt1+=judge(own[i],x[i]);
      for(int j=0;j<3;j++){
        scores[j]+=judge(str[j],x[i]);
      }
    }
    cnt2+=max(scores[0],max(scores[1],scores[2]));
  }
  cout<<cnt1<<endl<<cnt2;
}
int main(){
  int r,n;
  string own;
  cin>>r>>own>>n;
  vector<string> bro(n);
  for(auto &x:bro) cin>>x;
  score(own,bro);
  cout<<endl;
}